﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DCHealthCheck
{
    public class ExcludedServer
    {
        public ExcludedServer()
        {
            this.Description = string.Empty;
            this.SamAccountName = string.Empty;
            this.DN = string.Empty;
        }

        public string Description { get; set; }

        public string DN { get; set; }

        public Nullable<bool> ExcludeIfOffline { get; set; }

        public bool IsValid
        {
            get
            {
                return (!string.IsNullOrWhiteSpace(this.DN) || !string.IsNullOrWhiteSpace(this.SamAccountName));
            }
        }

        public string SamAccountName { get; set; }

        public override string ToString()
        {
            StringBuilder output = new StringBuilder();

            if (!string.IsNullOrWhiteSpace(this.Description)) {
                output.AppendFormat("Description: {0};", this.Description);
            }
            if (!string.IsNullOrWhiteSpace(this.SamAccountName)) {
                output.AppendFormat("SamAccountName: {0};", this.SamAccountName);
            }
            if (!string.IsNullOrWhiteSpace(this.DN)) {
                output.AppendFormat("DN: {0};", this.DN);
            }
            if (this.ExcludeIfOffline.HasValue && this.ExcludeIfOffline.Value) {
                output.AppendFormat("ExcludeIfOffline: {0}", this.ExcludeIfOffline.Value);
            }

            return output.ToString();
        }
    }
}
